package com.czxy.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Arrays;
import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor

@Table(name = "t_user")
public class User {

    @Id
    private Integer uid;
    private String loginName;
    private String loginPwd;
    private Integer age;
    private String sex;
    private Date   birthday;
    private String education;
    private String telephone;
    private String interest;		//爱好：对应数据库（内容：A,B,C）
    private String[] interestArr;	//爱好：对应页面表单
    private String remark;

    public String getInterest() {
        if(interestArr != null){
            interest = Arrays.toString(interestArr);  //[A,B,C]
            interest = interest.substring(1, interest.length() - 1);	//A,B,C
        }
        return interest;
    }
    public void setInterest(String interest) {
        this.interest = interest;
        if(interest != null){
            interestArr = interest.split(", ");
        }
    }

}
